package com.kedsoft.docms.mapper;

import com.kedsoft.docms.entity.TableDDL;
import com.kedsoft.docms.entity.TableInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/11/20.
 */
@Mapper
public interface TableMapper {
    @Select("select TABLE_NAME as name,TABLE_ROWS as rows,CREATE_TIME as crtime,engine  from information_schema.TABLES where TABLE_SCHEMA=(select database())")
    List<TableInfo> listTable();

    @Select("select * from information_schema.COLUMNS where TABLE_SCHEMA = (select database()) and TABLE_NAME=#{tableName}")
    List<Map> listTableColumn(String tableName);

    @Select("${ddl}")
    List<Map> getTableDDL(@Param("ddl") String ddl);
}
